home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre1.z / postgre1 / video / set-up-1.temp < prev    next >
Encoding:
Text File  |  1992-08-27  |  2.8 KB  |  99 lines

  1. define type city_budget ( internallength = 16, 
  2.               input = int44in, 
  3.               output = int44out, 
  4.               element = int4)
  5. \g
  6.  
  7. create person (name = char16, age = int4, location = point)
  8. \g
  9. create emp (salary = int4, dept = char16) inherits (person)
  10. \g
  11. create student (gpa = float8) inherits (person)
  12. \g
  13. create stud_emp (percent = int4) inherits (emp, student)
  14. \g
  15. create dept (dname = char16, mgrname = char16)
  16. \g
  17. create city (name = char16, location = box, budget = city_budget)
  18. \g
  19.  
  20. define function boxarea ( language = "c",
  21.               returntype = int4) 
  22.      arg is (box)
  23.      as "_CWD_/boxarea.o"
  24. \g
  25.  
  26. define function overpaid ( language = "c",
  27.                returntype = bool) 
  28.     arg is (emp)
  29.     as "_CWD_/overpaid.o"
  30. \g
  31. load "_CWD_/overpaid.o"
  32. \g
  33. load "_CWD_/boxarea.o"
  34. \g
  35. append person (name = "mike", age = 40, location = "(3.1,6.2)"::point)
  36. \g
  37.  
  38. append person (name = "joe", age = 20, location = "(5.5,2.5)"::point)
  39. \g
  40.  
  41. append person (name = "greg", age = 50, location = "(5.0,2.0)"::point)
  42. \g
  43.  
  44. append person (name = "bob", age = 18, location = "(0.0,0.0)"::point)
  45. \g
  46.  
  47. append dept (dname = "toy", mgrname = "sharon")
  48. \g
  49.  
  50. append dept (dname = "shoe", mgrname = "bob")
  51. \g
  52. append emp (name = "bill", age = 20, 
  53. location = "(11.0,10.0)"::point, salary = 1000, dept = "toy")
  54. \g
  55. append emp (name = "sharon", age = 25, 
  56. location = "(15.0,12.0)"::point, salary = 500, dept = "shoe")
  57. \g
  58. append emp (name = "sam", age = 30, 
  59. location = "(10.0,5.0)"::point, salary = 300, dept = "toy")
  60. \g
  61. append student (name = "fred", age = 28, location = "(3.1,-1.5)"::point, gpa = 3.7)
  62. \g
  63. append student (name = "larry", age = 60, location = "(21.8,4.9)"::point, gpa = 3.1)
  64. \g
  65. append stud_emp (name = "jeff", age = 23, 
  66. location = "(8.0,7.7)"::point, salary = 600, dept = "candy", gpa = 3.5)
  67. \g
  68. append stud_emp (name = "cim", age = 30, location = "(10.5,4.7)"::point, 
  69. salary = 400, dept = "shoe", gpa = 3.4)
  70. \g
  71. append stud_emp (name = "linda", age = 19, location = "(0.9,6.1)"::point, 
  72. salary = 100, dept = "candy", gpa = 2.9)
  73. \g
  74. append city (name = "berkeley", location = "(0.0,0.0,10.0,10.0)"::box, 
  75. budget = "250, 300, 325, 275"::city_budget)
  76. \g
  77. append city (name = "oakland", location = "(-10.0,-10.0,0.0,5.0)"::box,
  78. budget = "600, 400, 350, 500"::city_budget)
  79. \g
  80. append city (name = "elcerrito", location = "(10.0,0.0, 20.0,10.0)"::box,
  81. budget = "100, 100, 100, 100"::city_budget)
  82. \g
  83. append city (name = "richmond", location = "(20.0,5.0, 35.0,15.0)"::box,
  84. budget = "300, 320, 340, 360"::city_budget)
  85. \g
  86. append city (name = "sanpablo", location = "(35.0,20.0,40.0,30.0)"::box,
  87. budget = "50, 60, 65, 70"::city_budget)
  88. \g
  89. create slow_emp4000 (location = box)
  90. \g
  91. create fast_emp4000 (location = box)
  92. \g
  93. copy slow_emp4000 from "_CWD_/rect_data"
  94. \g
  95. copy fast_emp4000 from "_CWD_/rect_data"
  96. \g
  97. define index rect2ind on fast_emp4000 using rtree (location bigbox_ops)
  98. \g
  99.